﻿@model DLM.Domain.Model.Account
<script type="text/javascript">
    function onChangeSuccess() {
        ShowDialogMessage("right", "更新成功");
    }

    function onChangeFailed(ajaxContext) {
        ShowDialogMessage("warn", ajaxContext.responseText);
    }

    $(document).ready(function () {
        $("#txtConfirmedPass").blur(function () {
            var errorElement = $("#confirmError");
            if ($("#txtConfirmedPass").val() != $("#txtPassword").val()) {
                //.next('span.field-validation-error va');
                if (errorElement) {
                    errorElement.removeClass("field-validation-valid va");
                    errorElement.addClass("field-validation-error");
                    errorElement.append('<span htmlfor="txtModality" generated="true" class="" style="">密码不一致</span>');
                    errorElement.show();
                    $("#txtConfirmedPass").attr("class", "text input-validation-error");

                }
            } else {
                $("#txtConfirmedPass").attr("class", "text ");
                errorElement.children().remove();
                errorElement.hide();
            }
        });
    });

</script>
@using (Ajax.BeginForm("ChangePassword", "Account", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "divAccount", InsertionMode = InsertionMode.Replace, OnSuccess = "onChangeSuccess", OnFailure = "onChangeFailed" }))
{
               

    <h3>我的账户</h3>
    <div class="tr clearfix">
        <label class="lb">
            <s></s>&nbsp;</label>
        <div class="info">
            @Html.ValidationSummary(true, "账户修改失败，请重试！")
        </div>
    </div>
    <div class="tr clearfix">
        <label class="lb">
            <s></s>账号</label>
        <div class="info">
            @Html.HiddenFor(m => m.AccountID)
            @Html.TextBoxFor(m => m.AccountName, new { @class = "text", disabled = "disabled" })
            @Html.ValidationMessageFor(model => model.AccountName, "", new { @class = "va" })
        </div>
    </div>
    <div class="tr clearfix">
        <label class="lb">
            <s></s>密码</label>
        <div class="info">
            @Html.PasswordFor(m => m.Password, new { @class = "text", maxlength = 18, id = "txtPassword" })
            @Html.ValidationMessageFor(model => model.Password, "", new { @class = "va" })
        </div>
    </div>
    <div class="tr clearfix">
        <label class="lb">
            <s></s>确认密码</label>
        <div class="info">
            @Html.Password("txtConfirmedPass", "", new { @class = "text", maxlength = 18, id = "txtConfirmedPass" })
            @Html.ValidationMessage("", new { @class = "va", id = "confirmError" })
        </div>
    </div>
    <div class="tr clearfix">
        <label class="lb">
            <s></s>邮箱</label>
        <div class="info">
            @Html.TextBoxFor(m => m.Email, new { @class = "text", maxlength = 30 })
            @Html.ValidationMessageFor(model => model.Email, "", new { @class = "va" })
        </div>
    </div>
    <div class="tr clearfix btn">
        <label class="lb">
            <s></s>&nbsp;</label>
        <div class="info">
            <input type="submit" value="" class="edit_info" />
        </div>
    </div>
}
